CISC 1110 Lab 8

 

You are to write a main program which calls 2 functions. The program will print “Oh, rats!” and then will print “Rats!” a number of times that you specify.

 

Write ONE function at a time, write its prototype, and call it, testing whether it works before going on to write the next function.

 

1.      The function rats receives no parameters and returns no value, It simply prints the message "Oh, rats!" on the screen one time.

 

2.       The function manyrats receives an integer parameter called numrats, and prints "Rats!" on the screen numrats times (this will, of course, require a loop). The function does not return a value. If numrats has the value 4, this function should print the following on the screen:

 

Rats!

Rats!

Rats!

Rats!

 

3.      Write the call the function rats. This function does not receive any parameters and does not return a value.

4.      Next, assign an integer value to a variable numrats. The value should represent the number of times you want to print "Rats!" Then call manyrats, sending it the value of numrats as a parameter. So that the output looks nice, give numrats a value by assignment; don't enter it from cin.